home *** CD-ROM | disk | FTP | other *** search
- // CreateFileDlg.cpp : implementation file
- //
-
- #include "stdafx.h"
- #include "CreateFile.h"
- #include "CreateFileDlg.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CCreateFileDlg dialog
-
- CCreateFileDlg::CCreateFileDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CCreateFileDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CCreateFileDlg)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
- }
-
- void CCreateFileDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CCreateFileDlg)
- // NOTE: the ClassWizard will add DDX and DDV calls here
- //}}AFX_DATA_MAP
- }
-
- BEGIN_MESSAGE_MAP(CCreateFileDlg, CDialog)
- //{{AFX_MSG_MAP(CCreateFileDlg)
- ON_WM_PAINT()
- ON_WM_QUERYDRAGICON()
- ON_BN_CLICKED(IDC_OK, OnOk)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CCreateFileDlg message handlers
-
- BOOL CCreateFileDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- SetIcon(m_hIcon, TRUE); // Set big icon
- SetIcon(m_hIcon, FALSE); // Set small icon
-
- // TODO: Add extra initialization here
-
- return TRUE; // return TRUE unless you set the focus to a control
- }
-
- // If you add a minimize button to your dialog, you will need the code below
- // to draw the icon. For MFC applications using the document/view model,
- // this is automatically done for you by the framework.
-
- void CCreateFileDlg::OnPaint()
- {
- if (IsIconic())
- {
- CPaintDC dc(this); // device context for painting
-
- SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
-
- // Center icon in client rectangle
- int cxIcon = GetSystemMetrics(SM_CXICON);
- int cyIcon = GetSystemMetrics(SM_CYICON);
- CRect rect;
- GetClientRect(&rect);
- int x = (rect.Width() - cxIcon + 1) / 2;
- int y = (rect.Height() - cyIcon + 1) / 2;
-
- // Draw the icon
- dc.DrawIcon(x, y, m_hIcon);
- }
- else
- {
- CDialog::OnPaint();
- }
- }
-
- HCURSOR CCreateFileDlg::OnQueryDragIcon()
- {
- return (HCURSOR) m_hIcon;
- }
-
- void CCreateFileDlg::OnOk()
- {
- HANDLE File;
- BYTE Win9x = 0;
-
- __asm
- {
- push fs:[30h]
- pop eax
- test eax,eax // o jak² operaΦnφ systΘm se jednß?
- jns Not_Win9x // skok = operaΦnφm systΘmem je Windows 9x/Me
- mov byte ptr Win9x,1
-
- Not_Win9x:
- }
-
- if (Win9x)
- File = CreateFile( "\\\\.\\SICE",GENERIC_READ | GENERIC_WRITE,FILE_SHARE_READ | FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
- else
- File = CreateFile("\\\\.\\NTICE",GENERIC_READ | GENERIC_WRITE,FILE_SHARE_READ | FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
-
- if( File != INVALID_HANDLE_VALUE ) // byl ovladaΦ nalezen?
- {
- CloseHandle(File);
- MessageBox("SoftICE nalezen",NULL,MB_OK);
- }
- else
- MessageBox("SoftICE nenalezen",NULL,MB_OK);
- }
-